function trim(val)
{
	 return val.replace(/(^\s*)|(\s*$)/g, '');
}

function isMaxLen(o)
{
	 var nMaxLen=o.getAttribute? parseInt(o.getAttribute('maxlength')):'';
	 if(o.getAttribute && o.value.length>nMaxLen)
	 {
	 	  o.value=o.value.substring(0,nMaxLen);
	 }
}



function selectAll(){
	var checkall = document.getElementById('checkall');
	var listsize = document.getElementById('listsize').value;
	for(var i=0;i<listsize;i++){
		if(checkall.checked){
			document.getElementById('checkone'+i).checked = true;
		}else{
			document.getElementById('checkone'+i).checked = false;
		}
	}
}

function judgeCheck()
{
    var pkid_string = '';
		var listsize = document.getElementById('listsize').value;
		for(var i=0;i<listsize;i++)
		{
				if(document.getElementById('checkone'+i).checked)
				{
					pkid_string += document.getElementById('checkone'+i).value+'|';
				}
		}
    return pkid_string;
}

//var one_member_price ='';



function change( val ){
	if( val == '1' ){
		document.getElementById('reson1').style.display = 'block';
		document.getElementById('reson2').style.display = 'block';
	}
	else{
		document.getElementById('reson1').style.display = 'none';
		document.getElementById('reson2').style.display = 'none';
	}
}

function operateInfo(val){

	var oper = document.getElementById(val+'_operating').value;
	if(oper == ''){
		alert('请选择操作方式!');
		return false;
	}

	var listsize = document.getElementById('listsize').value;

	var pkid_string = judgeCheck();
	if( pkid_string == '' ){
		alert('请至少选择一条商品进行操作!');
		return false;
	}
	if( oper == '-' ){
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action = '/doTradeReg.do';
		document.getElementById('bpm_id').value = '3164';
		if(window.confirm('确认删除吗?')){
			document.indexForm.submit();
		}
 	} else if( 'abcd'.indexOf(oper) > -1 ) {
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action='/doTradeReg.do';
		document.getElementById('bpm_id').value = '8334';
		if(window.confirm('确认提交吗?')){
			document.indexForm.submit();
		}
	} else {
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action='/doTradeReg.do';
		document.getElementById('bpm_id').value = '2491';
		if(window.confirm('确认提交吗?')){
			document.indexForm.submit();
		}
	}

}

function deleteOneInfo(pkid,bpm_id)
{

	if(window.confirm('确认删除吗？'))
	{
	  window.location.href='/doTradeReg.do?pkid='+pkid+'&bpm_id='+bpm_id;
 	}
}

function textCounter(field, maxlimit)   {

	if(field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);

}

function ChangeClassStyle(){
	document.getElementById("class_attr").value = '';
	document.getElementById("classId1").style.display = 'none';
	document.getElementById("classId2").style.display = 'block';
}

function ChangeAreaStyle(){
	document.getElementById("area_attr").value = '';
	document.getElementById("areaId1").style.display = 'none';
	document.getElementById("areaId2").style.display = 'block';
}

function vForm(){

	document.addForm.submit();

}
function searchForm(){
	document.indexForm.submit();
}

var type = '4';

var fectureArray=new Array();
fectureArray=['请选择'];


